// **************************************************************
// Com ++ Framework by the C++ World
// Please report defects: mailto:compp@cplusplusworld.com
// Please visit: http://www.cplusplusworld.com/socketlibrary.html
// **************************************************************

#include <iostream>
#include <cstdlib>
#include "ComPlusPlus/ComPlusPlus"


int main ( int argc, char *argv [] ) {

  if ( argc != 4 ) {
    std::cout << "Usage: " << argv [0] << " Hostname|IP-Addr Port Text\n";	
  	exit(1);
  }
  
  std::string Host = argv [1];
  std::string Text = argv [3];
  	
  int CPort = std::atoi ( argv[2] );	

try {	
  compp::SocketUdp Clnt;
  Clnt.SetSockOptBroadcast ( true);

  // ************************** 1 *********************
  Clnt.Sendto(Text.data() , Text.length() , Host, CPort);  
  
  return 0;
} catch ( syspp::ComException e ) {
  std::cout << "Exception " << e.what( ) << "\n" ;	
	
}  	
}
